<template>
  <ElementDialog ref="dialog" embed :visible="visible" title="课题变更记录" height="500px">
    <PageableTable :api="getPage" payload-style="body" :selection="false" hide-on-single-page @cell-click="openForm">
      <TableColumn label="标题" prop="subject" clickable/>
      <TableColumn label="变更时间" prop="modifyTime" />
      <TableColumn label="变更理由" prop="reason" />
      <TableColumn label="作者" prop="createBy"/>
      <TableColumn label="所属单位" prop="deptFullName" />
    </PageableTable>
  </ElementDialog>
</template>

<script>
  import { getPage } from './api'

  export default {
    name: 'TopicUpdateRecordsDialog',
    props: {
      visible: Boolean,
      projectId: String
    },
    methods: {
      getPage(data) {
        data.example.projectId = this.projectId
        return getPage(data)
      },
      openForm(row,column){
        if (column.property === 'subject') {
          this.$refs.dialog.hide()
          this.$router.push(`/tech-project/project-manage/topic/update/ProjectTopicUpdateForm/${row.id}`)
        }
      }
    }
  }
</script>
